<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="decorator" content="default" />
<title>台账信息管理</title>
<script type="text/javascript">
	$(document).ready(
			function() {

				$("#hjff").select2({tags:eval('${fns:getDictValueListJson('hjff')}'),maximumSelectionSize: 1});
				$("#fxzt").select2({tags:eval('${fns:getDictValueListJson('dict_fxzt')}'),maximumSelectionSize: parseInt(eval('${fns:getDictValueListJson('dict_fxzt')}').length)});
				$("#hgjb").select2({tags:eval('${fns:getDictValueListJson('dict_hgjb')}'),maximumSelectionSize: parseInt(eval('${fns:getDictValueListJson('dict_hgjb')}').length)});
				$("#jcbl").select2({tags:eval('${fns:getDictValueListJson('dict_jcbl')}'),maximumSelectionSize: parseInt(eval('${fns:getDictValueListJson('dict_jcbl')}').length)});
				$("#cz").select2({maximumSelectionSize: parseInt('${fn:length(czList)}')});
				var idInForm = '${tz.id}';
				var rules = {},messages = {};
				rules = {
						hkbh: {
							remote:{
								url: "${ctx}/project/tz/checkExist",
								type: "post",
								data: {
									'subProject.id': function() {return $('#subProjectId').val();},
									gxh: function() {return $('#gxh').val();},
									oldHkbh: function() {return $('#oldHkbh').val();},
									hkbh: function() {return $('#hkbh').val();}
								}
							} 	
						}
					
				};
				messages = {
						hkbh: {remote: "此焊口编号在此管线号下已经存在"}
				};
				$("#inputForm")
						.validate(
								{
									rules: rules,
									messages: messages,	
									submitHandler : function(form) {
										loading('正在提交，请稍等...');
										form.submit();
									},
									errorContainer : "#messageBox",
									errorPlacement : function(error, element) {
										$("#messageBox").text("输入有误，请先更正。");
										if (element.is(":checkbox")
												|| element.is(":radio")
												|| element.parent().is(
														".input-append")) {
											error.appendTo(element.parent()
													.parent());
										} else {
											error.insertAfter(element);
										}
									}
								});
			});
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li ><a href="${ctx}/project/tz/list?projectId=${tz.subProject.project.id}&subProjectId=${tz.subProject.id}&suoxiePro=${tz.subProject.project.suoxie}&suoxieSub=${tz.subProject.suoxie}">台账列表</a></li>
		<li class="active"><a href="${ctx}/project/tz/form?projectId=${tz.subProject.project.id}&subProjectId=${tz.subProject.id}&suoxiePro=${tz.subProject.project.suoxie}&suoxieSub=${tz.subProject.suoxie}">台账信息添加</a></li>
	</ul>
	<common:message content="${message}" />
	<form:form id="inputForm" modelAttribute="tz"
		action="${ctx}/project/tz/save" method="post" class="form-horizontal">
		<form:hidden path="id" />
		<form:hidden path="subProject.id" />
		<form:hidden path="subProject.project.id" id="subProjectId"/>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">记录编号:</label>
					<div class="controls">
						<form:input path="xh" htmlEscape="false" maxlength="50"
							class="required"/>
							<span class="help-inline"><font color="red">* 请手动补齐记录编号</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">委托编号:</label>
					<div class="controls">
						<form:input path="wtbh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检件名称:</label>
					<div class="controls">
						<form:input path="jjmc" htmlEscape="false" maxlength="50"
							class="required" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检测日期:</label>
					<div class="controls">
						<input id="endDate" name="jcrq" type="text"  maxlength="20" class="input-large Wdate required"
			value="${tz.jcrq}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">管线号:</label>
					<div class="controls">
						<form:input path="gxh" htmlEscape="false" maxlength="50"
							class="required" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">焊口编号:</label>
					<div class="controls">
						<input id="oldHkbh" name="oldHkbh" type="hidden" value="${tz.hkbh}">
						<form:input path="hkbh" htmlEscape="false" maxlength="50"
							class="required" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">规格:</label>
					<div class="controls">
						<form:select path="gg" class="input-large required" onchange="onGGChange(this.value)">
							<form:option value="" label="请选择"/>
							<form:options items="${GGList}" htmlEscape="false"/>
						</form:select>
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<script type="text/javascript">
				function onGGChange(gg) {
					if(!gg)return;
					var projectId = '${tz.subProject.project.id}';
					$.post(
						'${ctx}/project/opGuide/loadOGByProGG',
						{'project.id':projectId, 'gg':gg},
						function(data,status) {
							if(data) {
								console.log(data);
								if(data.cz) {$('#cz').val(data.cz);}
								if(data.hjff) {$('#hjff').val(data.hjff).trigger('change');}
								if(data.tzcs) {$('#ps').val(data.tzcs);}
							}
						},'json'
					);
				}
			</script>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">材质:</label>
					<div class="controls">
						<select class="input-large required" name="cz" id="cz" multiple>
							<c:forEach items="${czList}" var="cz">
								<c:if test="${fn:contains(tz.cz, cz)}">
									<option value="${cz}" selected>${cz}</option>
								</c:if>
								<c:if test="${!fn:contains(tz.cz, cz)}">
									<option value="${cz}">${cz}</option>
								</c:if>
							</c:forEach>
						</select>
						<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">焊接方法:</label>
					<div class="controls">
					<form:input path="hjff" htmlEscape="false" maxlength="50"
							class="required input-large" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">透照张数:</label>
					<div class="controls">
						<form:input path="ps" htmlEscape="false" maxlength="50"
							class="required digits" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">焊工号:</label>
					<div class="controls">
						<form:input path="hgh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检测状态:</label>
					<div class="controls">
						<form:input path="fxzt" htmlEscape="false" maxlength="50"
									class="required input-large" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">返修片编号:</label>
					<div class="controls">
						<form:input path="fxpbh" htmlEscape="false" maxlength="50"
							class="" onchange="onFXPBHChange(this.value)"/>
							<span class="help-inline"><font color="red">注意,格式如: 1.2.3</font> </span>
					</div>
				</div>
			</div>
			<script type="text/javascript">
				function onFXPBHChange(value) {
					if(value&&value.indexOf('.')>=0) {
						var vArr = value.split('.');
						var vLast = parseInt(vArr[vArr.length-1]);
						$('#fxps').val(vLast);
					}
				}
			</script>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">最高返修次数:</label>
					<div class="controls">
						<form:input path="fxcs" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">一次返修片数:</label>
					<div class="controls">
						<form:input path="fxps" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">总返修片数:</label>
					<div class="controls">
						<form:input path="zfxps" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">重拍片编号:</label>
					<div class="controls">
						<form:input path="cpph" htmlEscape="false" maxlength="50"
							class=""  onchange="onCPBHChange(this.value);"/>
						<span class="help-inline"><font color="red">注意,格式如: 1.2.3</font> </span>
					</div>
				</div>
			</div>
			<script type="text/javascript">
				function onCPBHChange(value) {
					if(value&&value.indexOf('.')>=0) {
						var vArr = value.split('.');
						var vLast = parseInt(vArr[vArr.length-1]);
						$('#lwcps').val(vLast);
					}
				}
			</script>
			<div class="span6">
				<div class="control-group">
				<label class="control-label">重拍片数:</label>
					<div class="controls">
						<form:input path="lwcps" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">焊口状态:</label>
					<div class="controls">
						<form:select path="jcdd" class="input-large ">
							<form:option value="" label="请选择"/>
							<form:options items="${fns:getDictList('dict_hkzt')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检测比例:</label>
					<div class="controls">
						<form:input path="jcbl" htmlEscape="false" maxlength="50"
									class="required input-large" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">合格级别:</label>
					<div class="controls">
						<form:input path="hgjb" htmlEscape="false" maxlength="50"
									class="required input-large" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">管线焊口总数:</label>
					<div class="controls">
						<form:input path="gxhkzs" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">已委托焊口数:</label>
					<div class="controls">
						<form:input path="ywthks" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">底片袋号:</label>
					<div class="controls">
						<form:input path="dpdh" htmlEscape="false" maxlength="50"
							class="required"/>
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">扩检口数:</label>
					<div class="controls">
						<form:input path="kjks" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检测人员:</label>
					<div class="controls">
						<form:input path="jcry" htmlEscape="false" maxlength="50"
							class="required" />
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">委托日期:</label>
					<div class="controls">
						<input id="endDate" name="wtrq" type="text"  maxlength="20" class="input-large Wdate required"
			value="${tz.wtrq}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">检测方法:</label>
					<div class="controls">
						<form:select path="jcff" class="input-large  required">
							<form:option value="" label="请选择"/>
							<form:options items="${fns:getDictList('dict_jcff')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
							<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">射线源:</label>
					<div class="controls">
						<form:select path="sxy" class="input-large required">
							<form:option value="" label="请选择"/>
							<form:options items="${fns:getDictList('dict_sxy')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
						<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">备注:</label>
					<div class="controls">
						<form:input path="bz" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit"
				value="保 存" />&nbsp; 
				<input id="btnCancel" class="btn" type="button"
				value="返 回" onclick="history.go(-1)" />
		</div>
	</form:form>
</body>
</html>